﻿using System;
using System.Configuration;
using System.Web.UI.WebControls;
using Bank.DataSets;
using Bank.DataAccess;
public partial class GridViewDemo_CustomerDashBoard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        grdCustDashBoard.RowCommand += new GridViewCommandEventHandler(grdCustDashBoard_RowCommand);
        string s = ConfigurationManager.AppSettings["showdata"];
        //if (s.Equals("no")) return;
        CustomerData cd = new CustomerData();//data acces layer
        DsCustomer dsCust = cd.GetCustomer(); //int r=getRoll();
        grdCustDashBoard.DataSource = dsCust.Customer;
        grdCustDashBoard.DataBind();

        GridView1.DataSource = dsCust.Customer;
        GridView1.DataBind();
    }

    void grdCustDashBoard_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string cid = e.CommandArgument.ToString();
        if (e.CommandName.Equals("Edit"))
            Response.Redirect("~/GridViewDemo/EditPage.aspx?custId=" + cid);
        else if (e.CommandName.Equals("Delete"))
            Response.Redirect("~/GridViewDemo/DeletePage.aspx?custId=" + cid);
    }

   

    protected void mere_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string cid = e.CommandArgument.ToString();
        if (e.CommandName.Equals("Edit"))
            Response.Redirect("~/GridViewDemo/EditPage.aspx?custId=" + cid);
        else if (e.CommandName.Equals("Delete"))
            Response.Redirect("~/GridViewDemo/DeletePage.aspx?custId=" + cid);

    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        e.NewEditIndex = 1;
    }
}

